package com.iyundao.io.mapper;

import com.iyundao.io.model.Gift;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GiftCustomMapper {

    @Select("select * from gift where giftname like #{giftname,jdbcType=VARCHAR} " +
            "and organizationid=#{organizationid,jdbcType=VARCHAR}")
    List<Gift> selectByLike(String giftname,String organizationid);

    @Select("select * from gift where giftname like #{giftname,jdbcType=VARCHAR} " +
            "and organizationid=#{organizationid,jdbcType=VARCHAR} and giftflag=0")
    List<Gift> selectByLikeAndFlag(String giftname,String organizationid);

    @Delete("delete from gift where id=#{id,jdbcType=INTEGER}")
    int deleteGift(Integer id);

    @Delete("delete from giftimage where giftid=#{id,jdbcType=INTEGER}")
    int deleteGiftImage(Integer id);

}
